/*
 * AI 专区 FieldNode 注册表
 * 目标：将 AI 生成组件集中在单独入口，避免与内置组件高频冲突。
 */
import iconUsage from '@/assets/images/icon/icon_usage_trends.svg';
import { FieldNode } from '../types';

// UsageTrendsProd 主题色快速配置（与文档与现有实现保持一致）
const getUsageTrendsProdThemeColors = (themeType: string = 'white') => {
  if (themeType === 'white') {
    return {
      backgroundColor: '#FFFFFF',
      backgroundColorOpacity: 100,
      bgColor: '#FFFFFF',
      bgColorOpacity: 100,
      titleColor: '#242424',
      titleFontColor: '#242424',
      titleFontColorOpacity: 100,
      moreColor: '#6A52E8',
      selectedTabColor: '#6A52E8',
      selectedTabColorOpacity: 100,
      chartLineColor: '#6A52E8',
      chartLineColorOpacity: 100,
      chartAreaColor: 'rgba(106, 82, 232, 0.1)',
      chartAreaColorOpacity: 10,
      tooltipBackgroundColor: 'rgba(0, 0, 0, 0.8)',
      tooltipTextColor: '#FFFFFF',
      contentFontColor: '#545454',
      contentFontColorOpacity: 100,
      gridLineColor: '#D9D9D9',
      gridLineColorOpacity: 100,
      borderColor: '#E6E6E6',
      borderColorOpacity: 100,
      primaryColor: '#6A52E8',
      primaryColorOpacity: 100,
    };
  }
  return {} as any;
};

const fields: FieldNode[] = [
  {
    type: 'UsageTrendsProd2',
    module: '@/components/editor/schema/preview/aiCustomComponents',
    displayName: 'Usage Trends Dashboard',
    icon: iconUsage,
    totalNum: 999,
    props: {
      // Header
      visible: true,
      configureMode: '',

      // Visibility Rules
      groupSetting: '',
      profileSetting: [],
      targetLabel: '',
      needLogin: 'N',
      needTouristLogin: 'N',
      salesChannelType: [],
      androidValue: { miniVersion: '', maxVersion: '' },
      iosValue: { miniVersion: '', maxVersion: '' },

      // Effective Setting
      publishTime: '',
      expireTime: '',

      // Event Report Setting
      floorName: '',

      // Quick Template
      quickTemplate: 'white',

      // Title & More Configuration
      showTitleBar: true,
      title: 'Usage Trends at Last 6 Months',
      titleIcon: [{ src: '', width: 0, height: 0, iconName: '', link: '', linkId: '', linkType: '' }],
      showMore: true,
      moreIcon: [{ src: '', width: 0, height: 0, iconName: '', link: '', linkId: '', linkType: '' }],
      moreText: 'More',
      jumpLink: '',

      // Trend Data Configuration
      displayMonths: 6,
      enabledBalanceTypes: ['Voice', 'SMS', 'Data'],
      balanceTypeLabels: {},

      // Subtitle Configuration
      subtitleText: 'Usage Trends (MB)',
      subtitleColor: '',
      subtitleColorOpacity: 100,
      subtitleFontSize: '14',

      // Tab Configuration
      defaultActiveTab: 'Voice',
      maxTabCount: 4,
      tabBorderColor: '#d9d9d9',
      tabBackgroundColor: '#ffffff',
      tabTextColor: '#545454',

      // Title Style
      titleColor: '#242424',
      titleColorOpacity: 100,
      titleFontSize: '16',
      titleFontWeight: '600',
      isTitleFontBold: 'Y',
      isTitleFontItalic: 'N',
      isTitleFontUnderline: 'N',
      titleLineHeight: '24',
      titlePosition: 'left',
      titleIconPosition: 'L',
      moreColor: '#6A52E8',
      moreFontSize: '14',

      // Chart Style
      chartTheme: 'White',
      selectedTabColor: '#6A52E8',
      chartLineColor: '#6A52E8',
      chartLineColorOpacity: 100,
      chartAreaColor: 'rgba(106, 82, 232, 0.1)',
      chartAreaColorOpacity: 10,
      tooltipBackgroundColor: 'rgba(0, 0, 0, 0.8)',
      tooltipBackgroundColorOpacity: 80,
      tooltipTextColor: '#ffffff',
      gridLineColor: '#d9d9d9',
      gridLineColorOpacity: 100,

      // Component Style
      topPadding: '16',
      bottomPadding: '16',
      horizontalInnerPadding: '16',
      topMargin: '0',
      bottomMargin: '0',
      horizontalOutterMargin: '0',
      chartHeight: '250',
      hasBg: 'N',
      bgType: 'Color',
      bgColor: '#FFFFFF',
      bgColorOpacity: 100,
      bgImg: { src: '', width: 0, height: 0 },
      cornerRadius: '12',
      containerWidth: 'auto',

      // Extra fields (for system compatibility)
      contentFontColor: '',
      contentFontColorOpacity: 100,
      labelColor: '',
      labelColorOpacity: 100,
    },
  },
];

export default fields;
